let context = null
const initContext = (vue) => {
	context = vue;
}

//我的信息
const getUserInfoAsync = async (usermobile, token) => {
	let reqparam = {
		"Telphone": usermobile
	};
	let reqjsonStr = JSON.stringify(reqparam);
	let [error, result] = await context.commService.postEntityAsync("UserInfo", reqjsonStr, token);
	if (!error && result.statusCode == 200) {
		return result.data;
	}
	return null;
}

//用戶設置保存接口
const saveUserAddress = async (usermobile, useraddress, token) => {
	let reqparam = {
		Telphone: usermobile,
		HomeAddress: useraddress
	}
	let reqjsonStr = JSON.stringify(reqparam);
	let [error, result] = await context.commService.postEntityAsync("UserInfoSave", reqjsonStr, token);
	if (!error && result.statusCode == 200) {
		return result.data;
	}
	return null;
}


const meService = {
	initContext,
	getUserInfoAsync,
	saveUserAddress
}

export default meService
